package game;

import java.awt.Graphics2D;

public class Enemy extends BaseIsland
{
	int randomValue;
	int sort = 4;
	double time;
	public boolean possoReduzir = false;
	
	public Enemy() 
	{
		super(0, 0, 0, 0);
	
	}
	@Override
	public void Update(Level_01 level) {
		time += Game.loopTime;
		randomValue = Game.rand.nextInt(100);
		
		for(int i = 0; i< Army.size(); i++)
		{
			if(Army.get(i).getPosition().getX() < 400)
			{
				Army.remove(i);
				possoReduzir = true;
			}
		}
		
		if(time > sort)
		{
			if(randomValue <= 50)
			AddEnemyArmy(new EnemyTroop());
			
			if(randomValue > 50 && randomValue <= 80)
				AddEnemyArmy(new Ship());
			
			if(randomValue > 80)
				AddEnemyArmy(new Submarine());
			time = 0;
			
			sort = Game.rand.nextInt(25);
			if(sort <4) sort = 6;
		}
		// TODO Auto-generated method stub
		super.Update(level);
	}
	@Override
	public void Draw(Graphics2D graphics) {
		// TODO Auto-generated method stub
		super.Draw(graphics);
	}

}
